home *** CD-ROM | disk | FTP | other *** search
- ' Fire routine in PowerBasic by fr[ee]k on 12-20-1996
- ' ===================================================
- '
- ' Send your comments to magik@videotron.ca
- '
- ' No, i am not insane... I coded this fire routine
- ' in Basic to teach how to program them...
- ' Assembly is hard to understand.. but basic is easy
- ' and i never found any basic vga/demo src code
- '
- ' I will release every thing i know about vga demo in
- ' BASIC....
- '
- ' By the way, PowerBasic is not shit, look what i can
- ' code with it...
- '
- ' And they're we go...
- ' I hope it will be easy to read
- '
- ' THANKS to
- '
- ' -----------------------------------
- ' ------------> Vulture <------------
- ' -----------------------------------
- '
- ' For his good Source code
- '
- '
- ' I used the VGA 0013h routines from ftp.powerbasic.com to code it
- ' because PowerBasic can't do 320x200x256 by itself and asm routines
- ' is alwais faster than the BASIC ones
- '
- ' - fr[ee]k
-
-
- $OPTIMIZE SIZE ' Optimizr the EXE size
-
- TYPE RGB ' RGB Palette type
- R AS BYTE
- G AS BYTE
- B AS BYTE
- END TyPE
-
- '------------------[CODE START]--------------
- SCREEN13 ' Set 320x200x256
-
- for i% = 1 to 255 '
- SetRgb i%, i% / 4, 0, 0 ' Set the palette in red
- next i '
-
- Randomize Timer ' Randomize timer to get random
- ' Numbers from [rnd]
-
- DO ' Start the loop
-
- for i% = 1 to 319
- xpset i%, 199, int(100 + rnd * 15) ' It put the bottom random pixel
- ' line
-
- for j% = 198 to 150 step -1
- temp = xpoint(i%, j% + 1) - 5 ' Get the point color and
- ' drop the color by 5
- if not temp < 10 then
- xpset i%, j%, temp
- end if
-
- next j%
-
- next i%
-
- LOOP WHILE INKEY$ = "" ' Loop until someone press a key
-
- ' Fade down the palette
- for i% = 1 to 255
-
- for j% = 255 to 0 step -1
- SetRgb i%, j%,0,0
- next j%
-
- for t = 1 to 10000: next t ' Timer loop
- next i%
- TEXTMODE
-
- '-------------------[CODE END]---------------
- end
-
- 'switchs into SCREEN 13
- SUB SCREEN13 PUBLIC
-
- ! MOV AX , &h13
- ! INT &h10
-
- END SUB
-
- 'switchs into textmode
- SUB TEXTMODE PUBLIC
-
- ! MOV AX , &h3
- ! INT &h10
-
- END SUB
-
- 'sets a point witout clipping
- SUB XPSET (BYVAL x% ,BYVAL y% ,BYVAL col?) PUBLIC
-
- ! MOV AX , 320
- ! MUL y%
- ! MOV DI , AX ; Formel : 320 * y + x
- ! ADD DI , x% ; für Offset
- ! MOV DX , &hA000 ; Segment : A000h (Videospeicher)
- ! MOV ES , DX
- ! MOV AL , col? ; Farbe
- ! STOSB
-
- END SUB
-
- 'gets the color of a point
- FUNCTION XPOINT? (BYVAL x% , BYVAL y%) PUBLIC
- ! MOV AX , 320
- ! IMUL y%
- ! MOV SI , AX
- ! ADD SI , x%
- ! MOV DX , &hA000
- ! MOV ES , DX
- ! MOV AX , ES:[SI]
- ! MOV SP , BP
- ! POP BP
- ! RETF 4
- END FUNCTION
-
- SUB SetRGB(Nr% , r% , g% , b%)
- OUT &h3C8 , Nr%
- OUT &h3C9 , r%
- OUT &h3C9 , g%
- OUT &h3C9 , b%
- END SUB
-